/*********************************************************************************
 *      Copyright:  (C) 2025 ZYT
 *                  All rights reserved.
 *
 *       Filename:  thread2.c
 *    Description:  This file 
 *                 
 *        Version:  1.0.0(10/08/25)
 *         Author:  ZYT <zhangyuting@163.com>
 *      ChangeLog:  1, Release initial version on "10/08/25 09:32:35"
 *                 
 ********************************************************************************/
#include "main.h"
#include "bridge.h"
#include <stdio.h>
#include <unistd.h>

void* thread2_func(void* arg) 
{
	struct can_frame rx_frame;

	while (1) 
	{
		int 	i;
		if (bridge_to_thread2(&rx_frame) == 0) 
		{
			printf("[Thread2] Got CAN: ID=0x%08X  DLC=%d  ", rx_frame.can_id, rx_frame.can_dlc);
			for (i = 0; i < rx_frame.can_dlc; i++)                                    
			{       
				printf("Data[%d]=%02X ", i, rx_frame.data[i]);
			}
			printf("\n");
		}
		usleep(500000);
	}

	return NULL;
}
